package com.hfy.pcberpbackend.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 报价单主表实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("quotes")
public class Quote {
    
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    /**
     * 报价单编号
     */
    @NotBlank(message = "报价单编号不能为空")
    @TableField("quote_code")
    private String quoteCode;
    
    /**
     * 客户代码
     */
    @NotBlank(message = "客户代码不能为空")
    @TableField("customer_code")
    private String customerCode;
    
    /**
     * 客户名称
     */
    @NotBlank(message = "客户名称不能为空")
    @TableField("customer_name")
    private String customerName;
    
    /**
     * 业务员
     */
    @NotBlank(message = "业务员不能为空")
    @TableField("salesperson")
    private String salesperson;
    
    /**
     * 合同编号
     */
    @TableField("contract_number")
    private String contractNumber;
    
    /**
     * 订单日期
     */
    @NotNull(message = "订单日期不能为空")
    @TableField("order_date")
    private LocalDate orderDate;
    
    /**
     * 是否含税（0:否 1:增值税票13%）
     */
    @NotNull(message = "是否含税不能为空")
    @TableField("is_tax_included")
    private Integer isTaxIncluded;
    
    /**
     * 付款方式（CASH:现金 MONTHLY_30:月结30天 MONTHLY_60:月结60天）
     */
    @NotBlank(message = "付款方式不能为空")
    @Pattern(regexp = "^(CASH|MONTHLY_30|MONTHLY_60)$", message = "付款方式必须是CASH、MONTHLY_30或MONTHLY_60")
    @TableField("payment_method")
    private String paymentMethod;
    
    /**
     * 报价单总金额
     */
    @TableField("total_amount")
    private BigDecimal totalAmount;
    
    /**
     * 含税总金额
     */
    @TableField("total_tax_amount")
    private BigDecimal totalTaxAmount;
    
    /**
     * 状态（DRAFT:草稿 SUBMITTED:已提交 APPROVED:已批准 REJECTED:已拒绝）
     */
    @NotBlank(message = "状态不能为空")
    @Pattern(regexp = "^(DRAFT|SUBMITTED|APPROVED|REJECTED)$", message = "状态必须是DRAFT、SUBMITTED、APPROVED或REJECTED")
    @TableField("status")
    private String status;
    
    /**
     * 备注
     */
    @TableField("remark")
    private String remark;
    
    /**
     * 逻辑删除
     */
    @TableLogic
    @TableField("deleted")
    private Integer deleted;
    
    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
    
    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;
    
    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;
    
    /**
     * 更新人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;
} 